<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HTML文档类型</title>
<link rel="stylesheet" href="../css/reset.css" type="text/css" />
<link rel="stylesheet" href="../css/prettify.css" type="text/css" />
<script type="text/javascript" src="../js/prettify.js"></script>
</head>

<body onload="prettyPrint();">
<h1>WP创建自己的PHP文件</h1>
<hr />
<pre class="prettyprint linenums">
&lt;?php
require ('./wp-blog-header.php');
echo &lt;&lt;&lt;heredoc
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;data&gt;
	&lt;channel&gt;
heredoc;
global $wpdb;
$term = $wpdb-&gt;get_row ( "SELECT term_id FROM $wpdb-&gt;terms WHERE slug='ad-1'" );
$term_id = $term-&gt;term_id;
$results = $wpdb-&gt;get_results ( "SELECT object_id FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id='$term_id'" );
if ($results) {
	foreach ( $results as $result ) {
		$object_id = $result-&gt;object_id;
		$result = $wpdb-&gt;get_row ( "SELECT * FROM $wpdb-&gt;links WHERE link_id='$object_id'" );
		$link_url = $result-&gt;link_url;
		$link_name = $result-&gt;link_name;
		$link_description = $result-&gt;link_description;
		$link_image = $result-&gt;link_image;
		echo &lt;&lt;&lt;heredoc

		&lt;item&gt;
			&lt;image&gt;$link_image&lt;/image&gt;
			&lt;link&gt;$link_url&lt;/link&gt;
			&lt;title&gt;$link_name&lt;/title&gt;
		&lt;/item&gt;
heredoc;
	}
}
echo &lt;&lt;&lt;heredoc

	&lt;channel&gt;
	&lt;config&gt; 
		&lt;autoPlayTime&gt;5&lt;/autoPlayTime&gt;
		&lt;roundCorner&gt;3&lt;/roundCorner&gt;
		&lt;changImageMode&gt;hover&lt;/changImageMode&gt;
		&lt;isShowBtn&gt;true&lt;/isShowBtn&gt;
		&lt;isShowTitle&gt;true&lt;/isShowTitle&gt;
		&lt;transform&gt;left&lt;/transform&gt;
	&lt;/config&gt; 
&lt;/data&gt;
heredoc;
?&gt;
&lt;?php
//$post=get_blog_post(2, 2);
//echo $post-&gt;post_content;
?&gt;

</pre>
</html>
